﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MessageWorkflow.Handler;

namespace MessageWorkflow
{
    public class WorkflowHandlerConfiguration
    {
        public WorkflowHandlerConfiguration(IWorkflowHandler handler)
        {
            if (handler == null)
                throw new ArgumentNullException("handler");

            Handler = handler;
        }

        /// <summary>
        /// Get or set the handler for this configuration
        /// </summary>
        public IWorkflowHandler Handler { get; private set; }

        /// <summary>
        /// Get or set a collection of predecessors for this handler
        /// </summary>
        public IEnumerable<WorkflowHandlerConfiguration> Predecessors { get; set; }

        /// <summary>
        /// Get or set a collection of successors for this handler
        /// </summary>
        public IEnumerable<WorkflowHandlerConfiguration> Successors { get; set; }

        /// <summary>
        /// When set to true, this handler is registered as a predecessor to all. This property overwrites predecessors
        /// </summary>
        public bool IsPredecessorToAll { get; set; }

        /// <summary>
        /// When set to true, this handler is registered as a successor to all. This property overwrites Successors
        /// </summary>
        public bool IsSuccessorToAll { get; set; }
    }
}
